package com.whmskj.xjlhbc.mobile.controller;

import com.whmskj.xjlhbc.core.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class VersionInfoController {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @GetMapping("/docs/getAppVersionInfo")
    public AjaxResult getAppInfo(@RequestParam String version){
        String sql = "select * from appRelease where uploadTime > (select uploadTime from appRelease where versionNumber=?) order by uploadTime desc limit 1";
        Map<String, Object> map = new HashMap<>();
        try {
            map = jdbcTemplate.queryForMap(sql, version);
        }catch (Exception e){

        }
        return AjaxResult.success(map);
    }

}
